Java 类org.apache.hadoop.mapreduce.ID 实例源码

项目:hadoop    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:aliyun-oss-hadoop-fs    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:big-c    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hadoop-plus    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hops    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hadoop-TCP    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hardfs    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hadoop-on-lustre2    文件:JsonObjectMapperWriter.java   
public JsonObjectMapperWriter(OutputStream output, boolean prettyPrint) throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  mapper.configure(
      SerializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);

  // define a module
  SimpleModule module = new SimpleModule("Default Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  //   add default (all-pass) serializer for all rumen specific data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  //   add a serializer to use object.toString() while serializing
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());

  // register the module with the object-mapper
  mapper.registerModule(module);

  mapper.getJsonFactory();
  writer = mapper.getJsonFactory().createJsonGenerator(
      output, JsonEncoding.UTF8);
  if (prettyPrint) {
    writer.useDefaultPrettyPrinter();
  }
}
项目:hadoop    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:aliyun-oss-hadoop-fs    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:big-c    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hadoop-plus    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hops    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hadoop-TCP    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hardfs    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hadoop-on-lustre2    文件:ZombieJob.java   
private long sanitizeTaskRuntime(long time, ID id) {
  if (time < 0) {
    LOG.warn("Negative running time for task "+id+": "+time);
    return 100L; // set default to 100ms.
  }
  return time;
}
项目:hadoop    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:aliyun-oss-hadoop-fs    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:big-c    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:hadoop-plus    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:hops    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:hadoop-TCP    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:hardfs    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}
项目:hadoop-on-lustre2    文件:Anonymizer.java   
private void initialize(String[] args) throws Exception {
  try {
    for (int i = 0; i < args.length; ++i) {
      if ("-trace".equals(args[i])) {
        anonymizeTrace = true;
        inputTracePath = new Path(args[i+1]);
        outputTracePath = new Path(args[i+2]);
        i +=2;
      }
      if ("-topology".equals(args[i])) {
        anonymizeTopology = true;
        inputTopologyPath = new Path(args[i+1]);
        outputTopologyPath = new Path(args[i+2]);
        i +=2;
      }
    }
  } catch (Exception e) {
    throw new IllegalArgumentException("Illegal arguments list!", e);
  }

  if (!anonymizeTopology && !anonymizeTrace) {
    throw new IllegalArgumentException("Invalid arguments list!");
  }

  statePool = new StatePool();
  // initialize the state manager after the anonymizers are registered
  statePool.initialize(getConf());

  outMapper = new ObjectMapper();
  // define a module
  SimpleModule module = new SimpleModule("Anonymization Serializer",  
                                         new Version(0, 1, 1, "FINAL"));
  // add various serializers to the module
  // use the default (as-is) serializer for default data types
  module.addSerializer(DataType.class, new DefaultRumenSerializer());
  // use a blocking serializer for Strings as they can contain sensitive 
  // information
  module.addSerializer(String.class, new BlockingSerializer());
  // use object.toString() for object of type ID
  module.addSerializer(ID.class, new ObjectStringSerializer<ID>());
  // use getAnonymizedValue() for data types that have the anonymizing 
  // feature
  module.addSerializer(AnonymizableDataType.class, 
      new DefaultAnonymizingRumenSerializer(statePool, getConf()));

  // register the module with the object-mapper
  outMapper.registerModule(module);

  outFactory = outMapper.getJsonFactory();
}