You can use this,
public class WordCount {
public static class Map extends MapReduceBase implements
Mapper<LongWritable, Text, Text, IntWritable> {
public void configure(JobConf job) {
// put your initialization here
}
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
private String filename;
private boolean fopen=false;
private FSDataOutputStream dos;
public Map(String fname) {
.......
.......
}
...............
...............
...............
[/code]
On Sun, Oct 17, 2010 at 3:01 PM, web service <[email protected]> wrote:
> Ok. a bit confused...Noob days.
>
> Did you mean using this method call - public
> *JobConf*(Configuration<http://hadoop.apache.org/common/docs/r0.17.0/api/org/apache/hadoop/conf/Configuration.html>
> conf,
> Class <http://java.sun.com/j2se/1.5/docs/api/java/lang/Class.html>
> exampleClass)
> to initialize the Map class ?
>
> So for example, how would I invoke constructor to the below class ?
>
> [code]
> public class WordCount {
>
> public static class Map extends MapReduceBase implements
> Mapper<LongWritable, Text, Text, IntWritable> {
> private final static IntWritable one = new IntWritable(1);
> private Text word = new Text();
> private String filename;
> private boolean fopen=false;
> private FSDataOutputStream dos;
> public Map(String fname) {
> .......
> .......
> }
> ...............
> ...............
> ...............
> [/code]
>
>
>
> On Sun, Oct 17, 2010 at 12:38 PM, Owen O'Malley <[email protected]>wrote:
>
>>
>> On Oct 17, 2010, at 11:31 AM, web service wrote:
>>
>> I would want to initialize a Map class with some parameters. How do I do
>>> that ?
>>>
>>
>> The objects that define a MapReduce job are all configured by the job's
>> configuration, which is a string to string map. If your Mapper class
>> implements Configurable, it will be initialized with the job's configuration
>> automatically.
>>
>> -- Owen
>>
>
>