source: proiecte/HadoopJUnit/hadoop-0.20.1/docs/api/org/apache/hadoop/util/Tool.html @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 14.3 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.6.0_07) on Tue Sep 01 20:56:55 UTC 2009 -->
6<TITLE>
7Tool (Hadoop 0.20.1 API)
8</TITLE>
9
10<META NAME="date" CONTENT="2009-09-01">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    if (location.href.indexOf('is-external=true') == -1) {
18        parent.document.title="Tool (Hadoop 0.20.1 API)";
19    }
20}
21</SCRIPT>
22<NOSCRIPT>
23</NOSCRIPT>
24
25</HEAD>
26
27<BODY BGCOLOR="white" onload="windowTitle();">
28<HR>
29
30
31<!-- ========= START OF TOP NAVBAR ======= -->
32<A NAME="navbar_top"><!-- --></A>
33<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35<TR>
36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37<A NAME="navbar_top_firstrow"><!-- --></A>
38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39  <TR ALIGN="center" VALIGN="top">
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Tool.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48  </TR>
49</TABLE>
50</TD>
51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58&nbsp;<A HREF="../../../../org/apache/hadoop/util/StringUtils.TraditionalBinaryPrefix.html" title="enum in org.apache.hadoop.util"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../org/apache/hadoop/util/ToolRunner.html" title="class in org.apache.hadoop.util"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../index.html?org/apache/hadoop/util/Tool.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Tool.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<SCRIPT type="text/javascript">
64  <!--
65  if(window==top) {
66    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67  }
68  //-->
69</SCRIPT>
70<NOSCRIPT>
71  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
72</NOSCRIPT>
73
74
75</FONT></TD>
76</TR>
77<TR>
78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
79  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
82</TR>
83</TABLE>
84<A NAME="skip-navbar_top"></A>
85<!-- ========= END OF TOP NAVBAR ========= -->
86
87<HR>
88<!-- ======== START OF CLASS DATA ======== -->
89<H2>
90<FONT SIZE="-1">
91org.apache.hadoop.util</FONT>
92<BR>
93Interface Tool</H2>
94<DL>
95<DT><B>All Superinterfaces:</B> <DD><A HREF="../../../../org/apache/hadoop/conf/Configurable.html" title="interface in org.apache.hadoop.conf">Configurable</A></DD>
96</DL>
97<DL>
98<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../org/apache/hadoop/examples/DBCountPageView.html" title="class in org.apache.hadoop.examples">DBCountPageView</A>, <A HREF="../../../../org/apache/hadoop/examples/dancing/DistributedPentomino.html" title="class in org.apache.hadoop.examples.dancing">DistributedPentomino</A>, <A HREF="../../../../org/apache/hadoop/fs/FsShell.html" title="class in org.apache.hadoop.fs">FsShell</A>, <A HREF="../../../../org/apache/hadoop/examples/Grep.html" title="class in org.apache.hadoop.examples">Grep</A>, <A HREF="../../../../org/apache/hadoop/mapred/lib/InputSampler.html" title="class in org.apache.hadoop.mapred.lib">InputSampler</A>, <A HREF="../../../../org/apache/hadoop/mapred/JobClient.html" title="class in org.apache.hadoop.mapred">JobClient</A>, <A HREF="../../../../org/apache/hadoop/examples/Join.html" title="class in org.apache.hadoop.examples">Join</A>, <A HREF="../../../../org/apache/hadoop/fs/s3/MigrationTool.html" title="class in org.apache.hadoop.fs.s3">MigrationTool</A>, <A HREF="../../../../org/apache/hadoop/mapred/tools/MRAdmin.html" title="class in org.apache.hadoop.mapred.tools">MRAdmin</A>, <A HREF="../../../../org/apache/hadoop/examples/MultiFileWordCount.html" title="class in org.apache.hadoop.examples">MultiFileWordCount</A>, <A HREF="../../../../org/apache/hadoop/examples/PiEstimator.html" title="class in org.apache.hadoop.examples">PiEstimator</A>, <A HREF="../../../../org/apache/hadoop/examples/RandomTextWriter.html" title="class in org.apache.hadoop.examples">RandomTextWriter</A>, <A HREF="../../../../org/apache/hadoop/examples/RandomWriter.html" title="class in org.apache.hadoop.examples">RandomWriter</A>, <A HREF="../../../../org/apache/hadoop/examples/SleepJob.html" title="class in org.apache.hadoop.examples">SleepJob</A>, <A HREF="../../../../org/apache/hadoop/examples/Sort.html" title="class in org.apache.hadoop.examples">Sort</A>, <A HREF="../../../../org/apache/hadoop/streaming/StreamJob.html" title="class in org.apache.hadoop.streaming">StreamJob</A>, <A HREF="../../../../org/apache/hadoop/mapred/pipes/Submitter.html" title="class in org.apache.hadoop.mapred.pipes">Submitter</A>, <A HREF="../../../../org/apache/hadoop/examples/terasort/TeraGen.html" title="class in org.apache.hadoop.examples.terasort">TeraGen</A>, <A HREF="../../../../org/apache/hadoop/examples/terasort/TeraSort.html" title="class in org.apache.hadoop.examples.terasort">TeraSort</A>, <A HREF="../../../../org/apache/hadoop/examples/terasort/TeraValidate.html" title="class in org.apache.hadoop.examples.terasort">TeraValidate</A></DD>
99</DL>
100<HR>
101<DL>
102<DT><PRE>public interface <B>Tool</B><DT>extends <A HREF="../../../../org/apache/hadoop/conf/Configurable.html" title="interface in org.apache.hadoop.conf">Configurable</A></DL>
103</PRE>
104
105<P>
106A tool interface that supports handling of generic command-line options.
107 
108 <p><code>Tool</code>, is the standard for any Map-Reduce tool/application.
109 The tool/application should delegate the handling of
110 <a href="../../../../org/apache/hadoop/util/GenericOptionsParser.html#GenericOptions">
111 standard command-line options</a> to <A HREF="../../../../org/apache/hadoop/util/ToolRunner.html#run(org.apache.hadoop.util.Tool, java.lang.String[])"><CODE>ToolRunner.run(Tool, String[])</CODE></A> 
112 and only handle its custom arguments.</p>
113 
114 <p>Here is how a typical <code>Tool</code> is implemented:</p>
115 <p><blockquote><pre>
116     public class MyApp extends Configured implements Tool {
117     
118       public int run(String[] args) throws Exception {
119         // <code>Configuration</code> processed by <code>ToolRunner</code>
120         Configuration conf = getConf();
121         
122         // Create a JobConf using the processed <code>conf</code>
123         JobConf job = new JobConf(conf, MyApp.class);
124         
125         // Process custom command-line options
126         Path in = new Path(args[1]);
127         Path out = new Path(args[2]);
128         
129         // Specify various job-specific parameters     
130         job.setJobName("my-app");
131         job.setInputPath(in);
132         job.setOutputPath(out);
133         job.setMapperClass(MyApp.MyMapper.class);
134         job.setReducerClass(MyApp.MyReducer.class);
135
136         // Submit the job, then poll for progress until the job is complete
137         JobClient.runJob(job);
138       }
139       
140       public static void main(String[] args) throws Exception {
141         // Let <code>ToolRunner</code> handle generic command-line options
142         int res = ToolRunner.run(new Configuration(), new Sort(), args);
143         
144         System.exit(res);
145       }
146     }
147 </pre></blockquote></p>
148<P>
149
150<P>
151<DL>
152<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/hadoop/util/GenericOptionsParser.html" title="class in org.apache.hadoop.util"><CODE>GenericOptionsParser</CODE></A>,
153<A HREF="../../../../org/apache/hadoop/util/ToolRunner.html" title="class in org.apache.hadoop.util"><CODE>ToolRunner</CODE></A></DL>
154<HR>
155
156<P>
157
158<!-- ========== METHOD SUMMARY =========== -->
159
160<A NAME="method_summary"><!-- --></A>
161<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
162<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
163<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
164<B>Method Summary</B></FONT></TH>
165</TR>
166<TR BGCOLOR="white" CLASS="TableRowColor">
167<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
168<CODE>&nbsp;int</CODE></FONT></TD>
169<TD><CODE><B><A HREF="../../../../org/apache/hadoop/util/Tool.html#run(java.lang.String[])">run</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[]&nbsp;args)</CODE>
170
171<BR>
172&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Execute the command with the given arguments.</TD>
173</TR>
174</TABLE>
175&nbsp;<A NAME="methods_inherited_from_class_org.apache.hadoop.conf.Configurable"><!-- --></A>
176<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
177<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
178<TH ALIGN="left"><B>Methods inherited from interface org.apache.hadoop.conf.<A HREF="../../../../org/apache/hadoop/conf/Configurable.html" title="interface in org.apache.hadoop.conf">Configurable</A></B></TH>
179</TR>
180<TR BGCOLOR="white" CLASS="TableRowColor">
181<TD><CODE><A HREF="../../../../org/apache/hadoop/conf/Configurable.html#getConf()">getConf</A>, <A HREF="../../../../org/apache/hadoop/conf/Configurable.html#setConf(org.apache.hadoop.conf.Configuration)">setConf</A></CODE></TD>
182</TR>
183</TABLE>
184&nbsp;
185<P>
186
187<!-- ============ METHOD DETAIL ========== -->
188
189<A NAME="method_detail"><!-- --></A>
190<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
191<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
192<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
193<B>Method Detail</B></FONT></TH>
194</TR>
195</TABLE>
196
197<A NAME="run(java.lang.String[])"><!-- --></A><H3>
198run</H3>
199<PRE>
200int <B>run</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[]&nbsp;args)
201        throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A></PRE>
202<DL>
203<DD>Execute the command with the given arguments.
204<P>
205<DD><DL>
206</DL>
207</DD>
208<DD><DL>
209<DT><B>Parameters:</B><DD><CODE>args</CODE> - command specific arguments.
210<DT><B>Returns:</B><DD>exit code.
211<DT><B>Throws:</B>
212<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A></CODE></DL>
213</DD>
214</DL>
215<!-- ========= END OF CLASS DATA ========= -->
216<HR>
217
218
219<!-- ======= START OF BOTTOM NAVBAR ====== -->
220<A NAME="navbar_bottom"><!-- --></A>
221<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
222<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
223<TR>
224<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
225<A NAME="navbar_bottom_firstrow"><!-- --></A>
226<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
227  <TR ALIGN="center" VALIGN="top">
228  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
229  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
230  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
231  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Tool.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
232  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
233  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
234  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
235  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
236  </TR>
237</TABLE>
238</TD>
239<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
240</EM>
241</TD>
242</TR>
243
244<TR>
245<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
246&nbsp;<A HREF="../../../../org/apache/hadoop/util/StringUtils.TraditionalBinaryPrefix.html" title="enum in org.apache.hadoop.util"><B>PREV CLASS</B></A>&nbsp;
247&nbsp;<A HREF="../../../../org/apache/hadoop/util/ToolRunner.html" title="class in org.apache.hadoop.util"><B>NEXT CLASS</B></A></FONT></TD>
248<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
249  <A HREF="../../../../index.html?org/apache/hadoop/util/Tool.html" target="_top"><B>FRAMES</B></A>  &nbsp;
250&nbsp;<A HREF="Tool.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
251&nbsp;<SCRIPT type="text/javascript">
252  <!--
253  if(window==top) {
254    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
255  }
256  //-->
257</SCRIPT>
258<NOSCRIPT>
259  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
260</NOSCRIPT>
261
262
263</FONT></TD>
264</TR>
265<TR>
266<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
267  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
268<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
269DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
270</TR>
271</TABLE>
272<A NAME="skip-navbar_bottom"></A>
273<!-- ======== END OF BOTTOM NAVBAR ======= -->
274
275<HR>
276Copyright &copy; 2009 The Apache Software Foundation
277</BODY>
278</HTML>
Note: See TracBrowser for help on using the repository browser.