You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by tr...@apache.org on 2012/09/10 23:29:03 UTC
svn commit: r1383152 [26/27] - in /incubator/hcatalog/trunk: ./
hcatalog-pig-adapter/src/main/java/org/apache/hcatalog/pig/
hcatalog-pig-adapter/src/main/java/org/apache/hcatalog/pig/drivers/
hcatalog-pig-adapter/src/test/java/org/apache/hcatalog/pig/ ...
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CatchallExceptionMapper.java Mon Sep 10 23:28:55 2012
@@ -20,6 +20,7 @@ package org.apache.hcatalog.templeton;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -29,8 +30,7 @@ import org.apache.commons.logging.LogFac
*/
@Provider
public class CatchallExceptionMapper
- implements ExceptionMapper<Exception>
-{
+ implements ExceptionMapper<Exception> {
private static final Log LOG = LogFactory.getLog(CatchallExceptionMapper.class);
public Response toResponse(Exception e) {
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CompleteDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CompleteDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CompleteDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/CompleteDelegator.java Mon Sep 10 23:28:55 2012
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hcatalog.templeton.tool.JobState;
@@ -50,8 +51,7 @@ public class CompleteDelegator extends T
}
public CompleteBean run(String id)
- throws CallbackFailedException, IOException
- {
+ throws CallbackFailedException, IOException {
if (id == null)
acceptWithError("No jobid given");
@@ -64,7 +64,7 @@ public class CompleteDelegator extends T
Long notified = state.getNotifiedTime();
if (notified != null)
return acceptWithError("Callback already run on "
- + new Date(notified.longValue()));
+ + new Date(notified.longValue()));
String callback = state.getCallback();
if (callback == null)
@@ -90,16 +90,14 @@ public class CompleteDelegator extends T
* replaced with the completed jobid.
*/
public static void doCallback(String jobid, String url)
- throws MalformedURLException, IOException
- {
+ throws MalformedURLException, IOException {
if (url.contains("$jobId"))
url = url.replace("$jobId", jobid);
TempletonUtils.fetchUrl(new URL(url));
}
private void failed(String msg, Exception e)
- throws CallbackFailedException
- {
+ throws CallbackFailedException {
if (e != null)
LOG.error(msg, e);
else
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ExecServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ExecServiceImpl.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ExecServiceImpl.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ExecServiceImpl.java Mon Sep 10 23:28:55 2012
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Semaphore;
+
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteException;
@@ -67,12 +68,11 @@ public class ExecServiceImpl implements
* @param program The program to run
* @param args Arguments to pass to the program
* @param env Any extra environment variables to set
- * @return The result of the run.
+ * @return The result of the run.
*/
public ExecBean run(String program, List<String> args,
Map<String, String> env)
- throws NotAuthorizedException, BusyException, ExecuteException, IOException
- {
+ throws NotAuthorizedException, BusyException, ExecuteException, IOException {
boolean aquired = false;
try {
aquired = avail.tryAcquire();
@@ -95,12 +95,11 @@ public class ExecServiceImpl implements
* @param program The program to run.
* @param args Arguments to pass to the program
* @param env Any extra environment variables to set
- * @return The result of the run.
+ * @return The result of the run.
*/
public ExecBean runUnlimited(String program, List<String> args,
Map<String, String> env)
- throws NotAuthorizedException, ExecuteException, IOException
- {
+ throws NotAuthorizedException, ExecuteException, IOException {
try {
return auxRun(program, args, env);
} catch (IOException e) {
@@ -109,13 +108,12 @@ public class ExecServiceImpl implements
throw e;
else
throw new IOException("Invalid permissions on Templeton directory: "
- + cwd.getCanonicalPath());
+ + cwd.getCanonicalPath());
}
}
private ExecBean auxRun(String program, List<String> args, Map<String, String> env)
- throws NotAuthorizedException, ExecuteException, IOException
- {
+ throws NotAuthorizedException, ExecuteException, IOException {
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValues(null);
@@ -144,8 +142,7 @@ public class ExecServiceImpl implements
private CommandLine makeCommandLine(String program,
List<String> args)
- throws NotAuthorizedException, IOException
- {
+ throws NotAuthorizedException, IOException {
String path = validateProgram(program);
CommandLine cmd = new CommandLine(path);
if (args != null)
@@ -171,8 +168,8 @@ public class ExecServiceImpl implements
}
if (env != null)
res.putAll(env);
- for(Map.Entry<String, String> envs : res.entrySet()){
- LOG.info("Env " + envs.getKey() + "=" + envs.getValue());
+ for (Map.Entry<String, String> envs : res.entrySet()) {
+ LOG.info("Env " + envs.getKey() + "=" + envs.getValue());
}
return res;
}
@@ -182,11 +179,10 @@ public class ExecServiceImpl implements
* an exception if the program is missing or not authorized.
*
* @param path The path of the program.
- * @return The path of the validated program.
+ * @return The path of the validated program.
*/
public String validateProgram(String path)
- throws NotAuthorizedException, IOException
- {
+ throws NotAuthorizedException, IOException {
File f = new File(path);
if (f.canExecute()) {
return f.getCanonicalPath();
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java Mon Sep 10 23:28:55 2012
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
+
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -52,8 +53,7 @@ public class HcatDelegator extends Launc
*/
public ExecBean run(String user, String exec, boolean format,
String group, String permissions)
- throws NotAuthorizedException, BusyException, ExecuteException, IOException
- {
+ throws NotAuthorizedException, BusyException, ExecuteException, IOException {
SecureProxySupport proxy = new SecureProxySupport();
try {
List<String> args = makeArgs(exec, format, group, permissions);
@@ -103,8 +103,7 @@ public class HcatDelegator extends Launc
*/
public Response descDatabase(String user, String db, boolean extended)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = "desc database " + db + "; ";
if (extended)
exec = "desc database extended " + db + "; ";
@@ -115,12 +114,12 @@ public class HcatDelegator extends Launc
} catch (HcatException e) {
if (e.execBean.stderr.indexOf("Error in semantic analysis") > -1) {
return JsonBuilder.create().
- put("error", "Database " + db + " does not exist")
- .put("errorCode", "404")
- .put("database", db).build();
+ put("error", "Database " + db + " does not exist")
+ .put("errorCode", "404")
+ .put("database", db).build();
}
throw new HcatException("unable to describe database: " + db,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -130,8 +129,7 @@ public class HcatDelegator extends Launc
*/
public Response listDatabases(String user, String dbPattern)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("show databases like '%s';", dbPattern);
try {
String res = jsonRun(user, exec);
@@ -139,7 +137,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to show databases for: " + dbPattern,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -148,8 +146,7 @@ public class HcatDelegator extends Launc
*/
public Response createDatabase(String user, DatabaseDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = "create database";
if (desc.ifNotExists)
exec += " if not exists";
@@ -160,7 +157,7 @@ public class HcatDelegator extends Launc
exec += String.format(" location '%s'", desc.location);
if (TempletonUtils.isset(desc.properties))
exec += String.format(" with dbproperties (%s)",
- makePropertiesStatement(desc.properties));
+ makePropertiesStatement(desc.properties));
exec += ";";
String res = jsonRun(user, exec, desc.group, desc.permissions);
@@ -176,8 +173,7 @@ public class HcatDelegator extends Launc
boolean ifExists, String option,
String group, String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = "drop database";
if (ifExists)
exec += " if exists";
@@ -197,8 +193,7 @@ public class HcatDelegator extends Launc
*/
public Response createTable(String user, String db, TableDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = makeCreateTable(db, desc);
try {
@@ -210,7 +205,7 @@ public class HcatDelegator extends Launc
.build();
} catch (final HcatException e) {
throw new HcatException("unable to create table: " + desc.table,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -219,8 +214,7 @@ public class HcatDelegator extends Launc
*/
public Response createTableLike(String user, String db, TableLikeDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; create", db);
if (desc.external)
@@ -239,7 +233,7 @@ public class HcatDelegator extends Launc
.build();
} catch (final HcatException e) {
throw new HcatException("unable to create table: " + desc.newTable,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -248,8 +242,7 @@ public class HcatDelegator extends Launc
*/
public Response descTable(String user, String db, String table, boolean extended)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = "use " + db + "; ";
if (extended)
exec += "desc extended " + table + "; ";
@@ -263,7 +256,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to describe table: " + table,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -273,10 +266,9 @@ public class HcatDelegator extends Launc
*/
public Response listTables(String user, String db, String tablePattern)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; show tables like '%s';",
- db, tablePattern);
+ db, tablePattern);
try {
String res = jsonRun(user, exec);
return JsonBuilder.create(res)
@@ -284,7 +276,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to show tables for: " + tablePattern,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -294,10 +286,9 @@ public class HcatDelegator extends Launc
*/
public Response descExtendedTable(String user, String db, String table)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; show table extended like %s;",
- db, table);
+ db, table);
try {
String res = jsonRun(user, exec);
JsonBuilder jb = JsonBuilder.create(singleTable(res, table))
@@ -364,7 +355,7 @@ public class HcatDelegator extends Launc
exec += String.format(" location '%s'", desc.location);
if (TempletonUtils.isset(desc.tableProperties))
exec += String.format(" tblproperties (%s)",
- makePropertiesStatement(desc.tableProperties));
+ makePropertiesStatement(desc.tableProperties));
exec += ";";
return exec;
@@ -411,9 +402,9 @@ public class HcatDelegator extends Launc
private String makeRowFormat(TableDesc.RowFormatDesc desc) {
String res =
makeTermBy(desc.fieldsTerminatedBy, "fields")
- + makeTermBy(desc.collectionItemsTerminatedBy, "collection items")
- + makeTermBy(desc.mapKeysTerminatedBy, "map keys")
- + makeTermBy(desc.linesTerminatedBy, "lines");
+ + makeTermBy(desc.collectionItemsTerminatedBy, "collection items")
+ + makeTermBy(desc.mapKeysTerminatedBy, "map keys")
+ + makeTermBy(desc.linesTerminatedBy, "lines");
if (TempletonUtils.isset(res))
return "row format delimited" + res;
@@ -427,7 +418,7 @@ public class HcatDelegator extends Launc
private String makeTermBy(String sep, String fieldName) {
if (TempletonUtils.isset(sep))
- return String.format(" %s terminated by '%s'", fieldName, sep);
+ return String.format(" %s terminated by '%s'", fieldName, sep);
else
return "";
}
@@ -437,7 +428,7 @@ public class HcatDelegator extends Launc
String res = "row format serde " + desc.name;
if (TempletonUtils.isset(desc.properties))
res += String.format(" with serdeproperties (%s)",
- makePropertiesStatement(desc.properties));
+ makePropertiesStatement(desc.properties));
return res;
}
@@ -454,14 +445,13 @@ public class HcatDelegator extends Launc
String res = String.format("stored by '%s'", desc.className);
if (TempletonUtils.isset(desc.properties))
res += String.format(" with serdeproperties (%s)",
- makePropertiesStatement(desc.properties));
+ makePropertiesStatement(desc.properties));
return res;
}
// Pull out the first table from the "show extended" json.
private String singleTable(String json, String table)
- throws IOException
- {
+ throws IOException {
Map obj = JsonBuilder.jsonToMap(json);
if (JsonBuilder.isError(obj))
return json;
@@ -472,8 +462,8 @@ public class HcatDelegator extends Launc
else {
return JsonBuilder
.createError(String.format("Table %s does not exist", table),
- JsonBuilder.MISSING).
- buildJson();
+ JsonBuilder.MISSING).
+ buildJson();
}
}
@@ -484,8 +474,7 @@ public class HcatDelegator extends Launc
String table, boolean ifExists,
String group, String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; drop table", db);
if (ifExists)
exec += " if exists";
@@ -509,10 +498,9 @@ public class HcatDelegator extends Launc
String oldTable, String newTable,
String group, String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; alter table %s rename to %s;",
- db, oldTable, newTable);
+ db, oldTable, newTable);
try {
String res = jsonRun(user, exec, group, permissions, true);
return JsonBuilder.create(res)
@@ -521,7 +509,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to rename table: " + oldTable,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -531,8 +519,7 @@ public class HcatDelegator extends Launc
public Response descTableProperty(String user, String db,
String table, String property)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
Response res = descTable(user, db, table, true);
if (res.getStatus() != JsonBuilder.OK)
return res;
@@ -558,8 +545,7 @@ public class HcatDelegator extends Launc
*/
public Response listTableProperties(String user, String db, String table)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
Response res = descTable(user, db, table, true);
if (res.getStatus() != JsonBuilder.OK)
return res;
@@ -577,11 +563,10 @@ public class HcatDelegator extends Launc
public Response addOneTableProperty(String user, String db, String table,
TablePropertyDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec
= String.format("use %s; alter table %s set tblproperties ('%s'='%s');",
- db, table, desc.name, desc.value);
+ db, table, desc.name, desc.value);
try {
String res = jsonRun(user, exec, desc.group, desc.permissions, true);
return JsonBuilder.create(res)
@@ -591,12 +576,12 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to add table property: " + table,
- e.execBean, exec);
+ e.execBean, exec);
}
}
private Map tableProperties(Object extendedTable) {
- if (! (extendedTable instanceof Map))
+ if (!(extendedTable instanceof Map))
return null;
Map m = (Map) extendedTable;
Map tableInfo = (Map) m.get("tableInfo");
@@ -611,8 +596,7 @@ public class HcatDelegator extends Launc
*/
public Response listPartitions(String user, String db, String table)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = "use " + db + "; ";
exec += "show partitions " + table + "; ";
try {
@@ -623,7 +607,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to show partitions for table: " + table,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -633,8 +617,7 @@ public class HcatDelegator extends Launc
public Response descOnePartition(String user, String db, String table,
String partition)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = "use " + db + "; ";
exec += "show table extended like " + table
+ " partition (" + partition + "); ";
@@ -648,9 +631,9 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to show partition: "
- + table + " " + partition,
- e.execBean,
- exec);
+ + table + " " + partition,
+ e.execBean,
+ exec);
}
}
@@ -660,8 +643,7 @@ public class HcatDelegator extends Launc
public Response addOnePartition(String user, String db, String table,
PartitionDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; alter table %s add", db, table);
if (desc.ifNotExists)
exec += " if not exists";
@@ -673,11 +655,11 @@ public class HcatDelegator extends Launc
String res = jsonRun(user, exec, desc.group, desc.permissions, true);
if (res.indexOf("AlreadyExistsException") > -1) {
return JsonBuilder.create().
- put("error", "Partition already exists")
- .put("errorCode", "409")
- .put("database", db)
- .put("table", table)
- .put("partition", desc.partition).build();
+ put("error", "Partition already exists")
+ .put("errorCode", "409")
+ .put("database", db)
+ .put("table", table)
+ .put("partition", desc.partition).build();
}
return JsonBuilder.create(res)
.put("database", db)
@@ -686,7 +668,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to add partition: " + desc,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -697,8 +679,7 @@ public class HcatDelegator extends Launc
String table, String partition, boolean ifExists,
String group, String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; alter table %s drop", db, table);
if (ifExists)
exec += " if exists";
@@ -713,7 +694,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to drop partition: " + partition,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -723,13 +704,12 @@ public class HcatDelegator extends Launc
*/
public Response listColumns(String user, String db, String table)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
try {
return descTable(user, db, table, false);
} catch (HcatException e) {
throw new HcatException("unable to show columns for table: " + table,
- e.execBean, e.statement);
+ e.execBean, e.statement);
}
}
@@ -738,8 +718,7 @@ public class HcatDelegator extends Launc
*/
public Response descOneColumn(String user, String db, String table, String column)
throws SimpleWebException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
Response res = listColumns(user, db, table);
if (res.getStatus() != JsonBuilder.OK)
return res;
@@ -748,7 +727,7 @@ public class HcatDelegator extends Launc
final Map fields = (o != null && (o instanceof Map)) ? (Map) o : null;
if (fields == null)
throw new SimpleWebException(500, "Internal error, unable to find column "
- + column);
+ + column);
List<Map> cols = (List) fields.get("columns");
@@ -763,9 +742,11 @@ public class HcatDelegator extends Launc
}
if (found == null)
throw new SimpleWebException(500, "unable to find column " + column,
- new HashMap<String, Object>() {{
- put("description", fields);
- }});
+ new HashMap<String, Object>() {
+ {
+ put("description", fields);
+ }
+ });
fields.remove("columns");
fields.put("column", found);
return Response.fromResponse(res).entity(fields).build();
@@ -777,10 +758,9 @@ public class HcatDelegator extends Launc
public Response addOneColumn(String user, String db, String table,
ColumnDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
String exec = String.format("use %s; alter table %s add columns (%s %s",
- db, table, desc.name, desc.type);
+ db, table, desc.name, desc.type);
if (TempletonUtils.isset(desc.comment))
exec += String.format(" comment '%s'", desc.comment);
exec += ");";
@@ -793,7 +773,7 @@ public class HcatDelegator extends Launc
.build();
} catch (HcatException e) {
throw new HcatException("unable to add column: " + desc,
- e.execBean, exec);
+ e.execBean, exec);
}
}
@@ -826,11 +806,10 @@ public class HcatDelegator extends Launc
String group, String permissions,
boolean requireEmptyOutput)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
ExecBean res = run(user, exec, true, group, permissions);
- if (! isValid(res, requireEmptyOutput))
+ if (!isValid(res, requireEmptyOutput))
throw new HcatException("Failure calling hcat: " + exec, res, exec);
return res.stdout;
@@ -840,8 +819,7 @@ public class HcatDelegator extends Launc
// permissions set.
private String jsonRun(String user, String exec)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
return jsonRun(user, exec, null, null);
}
@@ -849,8 +827,7 @@ public class HcatDelegator extends Launc
private String jsonRun(String user, String exec,
String group, String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
return jsonRun(user, exec, group, permissions, false);
}
}
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatException.java Mon Sep 10 23:28:55 2012
@@ -27,10 +27,12 @@ public class HcatException extends Simpl
public String statement;
public HcatException(String msg, final ExecBean bean, final String statement) {
- super(500, msg, new HashMap<String, Object>() {{
- put("exec", bean);
- put("statement", statement);
- }});
+ super(500, msg, new HashMap<String, Object>() {
+ {
+ put("exec", bean);
+ put("statement", statement);
+ }
+ });
execBean = bean;
this.statement = statement;
}
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JarDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JarDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JarDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JarDelegator.java Mon Sep 10 23:28:55 2012
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+
import org.apache.commons.exec.ExecuteException;
import org.apache.hcatalog.templeton.tool.TempletonUtils;
@@ -40,12 +41,11 @@ public class JarDelegator extends Launch
List<String> jarArgs, List<String> defines,
String statusdir, String callback, String completedUrl)
throws NotAuthorizedException, BadParam, BusyException, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
runAs = user;
List<String> args = makeArgs(jar, mainClass,
- libjars, files, jarArgs, defines,
- statusdir, completedUrl);
+ libjars, files, jarArgs, defines,
+ statusdir, completedUrl);
return enqueueController(user, callback, args);
}
@@ -54,15 +54,14 @@ public class JarDelegator extends Launch
String libjars, String files,
List<String> jarArgs, List<String> defines,
String statusdir, String completedUrl)
- throws BadParam, IOException, InterruptedException
- {
+ throws BadParam, IOException, InterruptedException {
ArrayList<String> args = new ArrayList<String>();
try {
ArrayList<String> allFiles = new ArrayList();
allFiles.add(TempletonUtils.hadoopFsFilename(jar, appConf, runAs));
args.addAll(makeLauncherArgs(appConf, statusdir,
- completedUrl, allFiles));
+ completedUrl, allFiles));
args.add("--");
args.add(appConf.clusterHadoop());
args.add("jar");
@@ -72,12 +71,12 @@ public class JarDelegator extends Launch
if (TempletonUtils.isset(libjars)) {
args.add("-libjars");
args.add(TempletonUtils.hadoopFsListAsString(libjars, appConf,
- runAs));
+ runAs));
}
if (TempletonUtils.isset(files)) {
args.add("-files");
args.add(TempletonUtils.hadoopFsListAsString(files, appConf,
- runAs));
+ runAs));
}
for (String d : defines)
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/JsonBuilder.java Mon Sep 10 23:28:55 2012
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import org.apache.hcatalog.templeton.tool.TempletonUtils;
import org.codehaus.jackson.map.ObjectMapper;
@@ -40,8 +41,7 @@ public class JsonBuilder {
// Parse the json map.
private JsonBuilder(String json)
- throws IOException
- {
+ throws IOException {
map = jsonToMap(json);
}
@@ -49,8 +49,7 @@ public class JsonBuilder {
* Create a new map object from the existing json.
*/
public static JsonBuilder create(String json)
- throws IOException
- {
+ throws IOException {
return new JsonBuilder(json);
}
@@ -58,8 +57,7 @@ public class JsonBuilder {
* Create a new map object.
*/
public static JsonBuilder create()
- throws IOException
- {
+ throws IOException {
return new JsonBuilder(null);
}
@@ -67,8 +65,7 @@ public class JsonBuilder {
* Create a new map error object.
*/
public static JsonBuilder createError(String msg, int code)
- throws IOException
- {
+ throws IOException {
return new JsonBuilder(null)
.put("error", msg)
.put("errorCode", code);
@@ -109,8 +106,7 @@ public class JsonBuilder {
* Turn the map back to json.
*/
public String buildJson()
- throws IOException
- {
+ throws IOException {
return mapToJson(map);
}
@@ -153,8 +149,7 @@ public class JsonBuilder {
/**
* Check if this is an error doc.
*/
- public static boolean isError(Map obj)
- {
+ public static boolean isError(Map obj) {
return (obj != null) && obj.containsKey("error");
}
@@ -162,9 +157,8 @@ public class JsonBuilder {
* Convert a json string to a Map.
*/
public static Map jsonToMap(String json)
- throws IOException
- {
- if (! TempletonUtils.isset(json))
+ throws IOException {
+ if (!TempletonUtils.isset(json))
return new HashMap<String, Object>();
else {
ObjectMapper mapper = new ObjectMapper();
@@ -176,8 +170,7 @@ public class JsonBuilder {
* Convert a map to a json string.
*/
public static String mapToJson(Object obj)
- throws IOException
- {
+ throws IOException {
ObjectMapper mapper = new ObjectMapper();
ByteArrayOutputStream out = new ByteArrayOutputStream();
mapper.writeValue(out, obj);
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/LauncherDelegator.java Mon Sep 10 23:28:55 2012
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
+
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,8 +49,7 @@ public class LauncherDelegator extends T
}
public void registerJob(String id, String user, String callback)
- throws IOException
- {
+ throws IOException {
JobState state = null;
try {
state = new JobState(id, Main.getAppConfigInstance());
@@ -65,12 +65,11 @@ public class LauncherDelegator extends T
* Enqueue the TempletonControllerJob directly calling doAs.
*/
public EnqueueBean enqueueController(String user, String callback,
- List<String> args)
+ List<String> args)
throws NotAuthorizedException, BusyException, ExecuteException,
- IOException, QueueException
- {
+ IOException, QueueException {
try {
- UserGroupInformation ugi = UgiFactory.getUgi(user);
+ UserGroupInformation ugi = UgiFactory.getUgi(user);
final long startTime = System.nanoTime();
@@ -91,24 +90,22 @@ public class LauncherDelegator extends T
}
private String queueAsUser(UserGroupInformation ugi, final List<String> args)
- throws IOException, InterruptedException
- {
+ throws IOException, InterruptedException {
String id = ugi.doAs(new PrivilegedExceptionAction<String>() {
- public String run() throws Exception {
- String[] array = new String[args.size()];
- TempletonControllerJob ctrl = new TempletonControllerJob();
- ToolRunner.run(ctrl, args.toArray(array));
- return ctrl.getSubmittedId();
- }
- });
+ public String run() throws Exception {
+ String[] array = new String[args.size()];
+ TempletonControllerJob ctrl = new TempletonControllerJob();
+ ToolRunner.run(ctrl, args.toArray(array));
+ return ctrl.getSubmittedId();
+ }
+ });
return id;
}
public List<String> makeLauncherArgs(AppConfig appConf, String statusdir,
String completedUrl,
- List<String> copyFiles)
- {
+ List<String> copyFiles) {
ArrayList<String> args = new ArrayList<String>();
args.add("-libjars");
@@ -122,9 +119,9 @@ public class LauncherDelegator extends T
// Internal vars
addDef(args, TempletonControllerJob.STATUSDIR_NAME, statusdir);
addDef(args, TempletonControllerJob.COPY_NAME,
- TempletonUtils.encodeArray(copyFiles));
+ TempletonUtils.encodeArray(copyFiles));
addDef(args, TempletonControllerJob.OVERRIDE_CLASSPATH,
- makeOverrideClasspath(appConf));
+ makeOverrideClasspath(appConf));
// Job vars
addStorageVars(args);
@@ -136,21 +133,21 @@ public class LauncherDelegator extends T
// Storage vars
private void addStorageVars(List<String> args) {
addDef(args, TempletonStorage.STORAGE_CLASS,
- appConf.get(TempletonStorage.STORAGE_CLASS));
+ appConf.get(TempletonStorage.STORAGE_CLASS));
addDef(args, TempletonStorage.STORAGE_ROOT,
- appConf.get(TempletonStorage.STORAGE_ROOT));
+ appConf.get(TempletonStorage.STORAGE_ROOT));
addDef(args, ZooKeeperStorage.ZK_HOSTS,
- appConf.get(ZooKeeperStorage.ZK_HOSTS));
+ appConf.get(ZooKeeperStorage.ZK_HOSTS));
addDef(args, ZooKeeperStorage.ZK_SESSION_TIMEOUT,
- appConf.get(ZooKeeperStorage.ZK_SESSION_TIMEOUT));
+ appConf.get(ZooKeeperStorage.ZK_SESSION_TIMEOUT));
}
// Completion notifier vars
private void addCompletionVars(List<String> args, String completedUrl) {
addDef(args, AppConfig.HADOOP_END_RETRY_NAME,
- appConf.get(AppConfig.CALLBACK_RETRY_NAME));
+ appConf.get(AppConfig.CALLBACK_RETRY_NAME));
addDef(args, AppConfig.HADOOP_END_INTERVAL_NAME,
- appConf.get(AppConfig.CALLBACK_INTERVAL_NAME));
+ appConf.get(AppConfig.CALLBACK_INTERVAL_NAME));
addDef(args, AppConfig.HADOOP_END_URL_NAME, completedUrl);
}
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ListDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ListDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ListDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/ListDelegator.java Mon Sep 10 23:28:55 2012
@@ -20,6 +20,7 @@ package org.apache.hcatalog.templeton;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
+
import org.apache.hadoop.mapred.JobStatus;
import org.apache.hadoop.mapred.JobTracker;
import org.apache.hadoop.mapred.TempletonJobTracker;
@@ -35,14 +36,13 @@ public class ListDelegator extends Templ
}
public List<String> run(String user)
- throws NotAuthorizedException, BadParam, IOException
- {
+ throws NotAuthorizedException, BadParam, IOException {
UserGroupInformation ugi = UserGroupInformation.createRemoteUser(user);
TempletonJobTracker tracker = null;
try {
tracker = new TempletonJobTracker(ugi,
- JobTracker.getAddress(appConf),
- appConf);
+ JobTracker.getAddress(appConf),
+ appConf);
ArrayList<String> ids = new ArrayList<String>();
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Main.java Mon Sep 10 23:28:55 2012
@@ -24,6 +24,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hdfs.web.AuthFilter;
@@ -116,31 +117,30 @@ public class Main {
private void checkEnv() {
checkCurrentDirPermissions();
-
+
}
private void checkCurrentDirPermissions() {
//org.apache.commons.exec.DefaultExecutor requires
// that current directory exists
File pwd = new File(".");
- if(!pwd.exists()){
+ if (!pwd.exists()) {
String msg = "Server failed to start: templeton: Current working directory '.' does not exist!";
System.err.println(msg);
- LOG.fatal( msg);
+ LOG.fatal(msg);
System.exit(1);
}
}
public Server runServer(int port)
- throws Exception
- {
+ throws Exception {
//Authenticate using keytab
- if(UserGroupInformation.isSecurityEnabled()){
+ if (UserGroupInformation.isSecurityEnabled()) {
UserGroupInformation.loginUserFromKeytab(conf.kerberosPrincipal(),
- conf.kerberosKeytab());
+ conf.kerberosKeytab());
}
-
+
// Create the Jetty server
Server server = new Server(port);
ServletContextHandler root = new ServletContextHandler(server, "/");
@@ -166,11 +166,11 @@ public class Main {
FilterHolder authFilter = new FilterHolder(AuthFilter.class);
if (UserGroupInformation.isSecurityEnabled()) {
authFilter.setInitParameter("dfs.web.authentication.signature.secret",
- conf.kerberosSecret());
+ conf.kerberosSecret());
authFilter.setInitParameter("dfs.web.authentication.kerberos.principal",
- conf.kerberosPrincipal());
+ conf.kerberosPrincipal());
authFilter.setInitParameter("dfs.web.authentication.kerberos.keytab",
- conf.kerberosKeytab());
+ conf.kerberosKeytab());
}
return authFilter;
}
@@ -181,7 +181,7 @@ public class Main {
HashMap<String, Object> props = new HashMap<String, Object>();
props.put("com.sun.jersey.api.json.POJOMappingFeature", "true");
props.put("com.sun.jersey.config.property.WadlGeneratorConfig",
- "org.apache.hcatalog.templeton.WadlConfig");
+ "org.apache.hcatalog.templeton.WadlConfig");
rc.setPropertiesAndFeatures(props);
return rc;
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/PigDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/PigDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/PigDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/PigDelegator.java Mon Sep 10 23:28:55 2012
@@ -23,6 +23,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import org.apache.commons.exec.ExecuteException;
import org.apache.hcatalog.templeton.tool.TempletonUtils;
@@ -41,12 +42,11 @@ public class PigDelegator extends Launch
List<String> pigArgs, String otherFiles,
String statusdir, String callback, String completedUrl)
throws NotAuthorizedException, BadParam, BusyException, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
runAs = user;
List<String> args = makeArgs(execute,
- srcFile, pigArgs,
- otherFiles, statusdir, completedUrl);
+ srcFile, pigArgs,
+ otherFiles, statusdir, completedUrl);
return enqueueController(user, callback, args);
}
@@ -54,17 +54,15 @@ public class PigDelegator extends Launch
private List<String> makeArgs(String execute, String srcFile,
List<String> pigArgs, String otherFiles,
String statusdir, String completedUrl)
- throws BadParam, IOException, InterruptedException
- {
+ throws BadParam, IOException, InterruptedException {
ArrayList<String> args = new ArrayList<String>();
try {
ArrayList<String> allFiles = new ArrayList<String>();
if (TempletonUtils.isset(srcFile))
allFiles.add(TempletonUtils.hadoopFsFilename
- (srcFile, appConf, runAs));
+ (srcFile, appConf, runAs));
if (TempletonUtils.isset(otherFiles)) {
- String[] ofs = TempletonUtils.hadoopFsListAsArray
- (otherFiles, appConf, runAs);
+ String[] ofs = TempletonUtils.hadoopFsListAsArray(otherFiles, appConf, runAs);
allFiles.addAll(Arrays.asList(ofs));
}
@@ -81,7 +79,7 @@ public class PigDelegator extends Launch
} else if (TempletonUtils.isset(srcFile)) {
args.add("-file");
args.add(TempletonUtils.hadoopFsPath(srcFile, appConf, runAs)
- .getName());
+ .getName());
}
} catch (FileNotFoundException e) {
throw new BadParam(e.getMessage());
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueStatusBean.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueStatusBean.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueStatusBean.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/QueueStatusBean.java Mon Sep 10 23:28:55 2012
@@ -18,6 +18,7 @@
package org.apache.hcatalog.templeton;
import java.io.IOException;
+
import org.apache.hadoop.mapred.JobStatus;
import org.apache.hadoop.mapred.JobProfile;
import org.apache.hcatalog.templeton.tool.JobState;
@@ -29,15 +30,16 @@ public class QueueStatusBean {
public JobStatus status;
public JobProfile profile;
- public String id;
- public String parentId;
- public String percentComplete;
- public Long exitValue;
- public String user;
- public String callback;
- public String completed;
+ public String id;
+ public String parentId;
+ public String percentComplete;
+ public Long exitValue;
+ public String user;
+ public String callback;
+ public String completed;
- public QueueStatusBean() {}
+ public QueueStatusBean() {
+ }
/**
* Create a new QueueStatusBean
@@ -47,19 +49,18 @@ public class QueueStatusBean {
* @param profile job profile
*/
public QueueStatusBean(JobState state, JobStatus status, JobProfile profile)
- throws IOException
- {
+ throws IOException {
this.status = status;
this.profile = profile;
- id = profile.getJobID().toString();
- parentId = state.getId();
+ id = profile.getJobID().toString();
+ parentId = state.getId();
if (id.equals(parentId))
parentId = null;
percentComplete = state.getPercentComplete();
- exitValue = state.getExitValue();
- user = state.getUser();
- callback = state.getCallback();
- completed = state.getCompleteStatus();
+ exitValue = state.getExitValue();
+ user = state.getUser();
+ callback = state.getCallback();
+ completed = state.getCompleteStatus();
}
}
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SecureProxySupport.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SecureProxySupport.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SecureProxySupport.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SecureProxySupport.java Mon Sep 10 23:28:55 2012
@@ -52,23 +52,26 @@ public class SecureProxySupport {
}
private static final Log LOG = LogFactory.getLog(SecureProxySupport.class);
-
+
/**
* The file where we store the auth token
*/
- public Path getTokenPath() { return( tokenPath ); }
+ public Path getTokenPath() {
+ return (tokenPath);
+ }
/**
* The token to pass to hcat.
*/
- public String getHcatServiceStr() { return( HCAT_SERVICE ); }
+ public String getHcatServiceStr() {
+ return (HCAT_SERVICE);
+ }
/**
* Create the delegation token.
*/
public Path open(String user, Configuration conf)
- throws IOException, InterruptedException
- {
+ throws IOException, InterruptedException {
close();
if (isEnabled) {
this.user = user;
@@ -85,7 +88,7 @@ public class SecureProxySupport {
msToken.decodeFromUrlString(hcatTokenStr);
msToken.setService(new Text(HCAT_SERVICE));
writeProxyDelegationTokens(fsToken, msToken, conf, user, tokenPath);
-
+
}
return tokenPath;
}
@@ -106,7 +109,7 @@ public class SecureProxySupport {
public void addEnv(Map<String, String> env) {
if (isEnabled) {
env.put(UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION,
- getTokenPath().toUri().getPath());
+ getTokenPath().toUri().getPath());
}
}
@@ -118,73 +121,70 @@ public class SecureProxySupport {
args.add("-D");
args.add("hive.metastore.token.signature=" + getHcatServiceStr());
args.add("-D");
- args.add("proxy.user.name=" + user);
+ args.add("proxy.user.name=" + user);
}
}
-
- class TokenWrapper {
+
+ class TokenWrapper {
Token<?> token;
}
private Token<?> getFSDelegationToken(String user,
- final Configuration conf)
- throws IOException, InterruptedException
- {
+ final Configuration conf)
+ throws IOException, InterruptedException {
LOG.info("user: " + user + " loginUser: " + UserGroupInformation.getLoginUser().getUserName());
final UserGroupInformation ugi = UgiFactory.getUgi(user);
- final TokenWrapper twrapper = new TokenWrapper();
- ugi.doAs(new PrivilegedExceptionAction<Object>() {
- public Object run() throws IOException {
- FileSystem fs = FileSystem.get(conf);
- twrapper.token = fs.getDelegationToken(ugi.getShortUserName());
- return null;
- }
- });
- return twrapper.token;
-
+ final TokenWrapper twrapper = new TokenWrapper();
+ ugi.doAs(new PrivilegedExceptionAction<Object>() {
+ public Object run() throws IOException {
+ FileSystem fs = FileSystem.get(conf);
+ twrapper.token = fs.getDelegationToken(ugi.getShortUserName());
+ return null;
+ }
+ });
+ return twrapper.token;
+
}
private void writeProxyDelegationTokens(final Token<?> fsToken,
- final Token<?> msToken,
- final Configuration conf,
- String user,
- final Path tokenPath)
- throws IOException, InterruptedException{
-
-
+ final Token<?> msToken,
+ final Configuration conf,
+ String user,
+ final Path tokenPath)
+ throws IOException, InterruptedException {
+
+
LOG.info("user: " + user + " loginUser: " + UserGroupInformation.getLoginUser().getUserName());
- final UserGroupInformation ugi = UgiFactory.getUgi(user);
+ final UserGroupInformation ugi = UgiFactory.getUgi(user);
+
-
ugi.doAs(new PrivilegedExceptionAction<Object>() {
- public Object run() throws IOException {
- Credentials cred = new Credentials();
- cred.addToken(fsToken.getService(), fsToken);
- cred.addToken(msToken.getService(), msToken);
- cred.writeTokenStorageFile(tokenPath, conf);
- return null;
- }
- });
-
+ public Object run() throws IOException {
+ Credentials cred = new Credentials();
+ cred.addToken(fsToken.getService(), fsToken);
+ cred.addToken(msToken.getService(), msToken);
+ cred.writeTokenStorageFile(tokenPath, conf);
+ return null;
+ }
+ });
+
}
-
+
private String buildHcatDelegationToken(String user)
- throws IOException, InterruptedException, MetaException, TException
- {
+ throws IOException, InterruptedException, MetaException, TException {
HiveConf c = new HiveConf();
final HiveMetaStoreClient client = new HiveMetaStoreClient(c);
LOG.info("user: " + user + " loginUser: " + UserGroupInformation.getLoginUser().getUserName());
final TokenWrapper twrapper = new TokenWrapper();
final UserGroupInformation ugi = UgiFactory.getUgi(user);
String s = ugi.doAs(new PrivilegedExceptionAction<String>() {
- public String run()
- throws IOException, MetaException, TException
- {
- String u = ugi.getUserName();
- return client.getDelegationToken(u);
- }
- });
+ public String run()
+ throws IOException, MetaException, TException {
+ String u = ugi.getUserName();
+ return client.getDelegationToken(u);
+ }
+ });
return s;
}
}
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Server.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Server.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Server.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/Server.java Mon Sep 10 23:28:55 2012
@@ -39,6 +39,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -103,10 +104,14 @@ public class Server {
private static AppConfig appConf = Main.getAppConfigInstance();
// The SecurityContext set by AuthFilter
- private @Context SecurityContext theSecurityContext;
+ private
+ @Context
+ SecurityContext theSecurityContext;
// The uri requested
- private @Context UriInfo theUriInfo;
+ private
+ @Context
+ UriInfo theUriInfo;
private static final Log LOG = LogFactory.getLog(Server.class);
@@ -150,8 +155,7 @@ public class Server {
@FormParam("group") String group,
@FormParam("permissions") String permissions)
throws NotAuthorizedException, BusyException, BadParam,
- ExecuteException, IOException
- {
+ ExecuteException, IOException {
verifyUser();
verifyParam(exec, "exec");
@@ -168,13 +172,12 @@ public class Server {
public Response listTables(@PathParam("db") String db,
@QueryParam("like") String tablePattern)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
HcatDelegator d = new HcatDelegator(appConf, execService);
- if (! TempletonUtils.isset(tablePattern))
+ if (!TempletonUtils.isset(tablePattern))
tablePattern = "*";
return d.listTables(getUser(), db, tablePattern);
}
@@ -189,8 +192,7 @@ public class Server {
@PathParam("table") String table,
TableDesc desc)
throws SimpleWebException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -211,8 +213,7 @@ public class Server {
@PathParam("newTable") String newTable,
TableLikeDesc desc)
throws SimpleWebException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(existingTable, ":existingTable");
@@ -236,8 +237,7 @@ public class Server {
@PathParam("table") String table,
@QueryParam("format") String format)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -261,8 +261,7 @@ public class Server {
@QueryParam("group") String group,
@QueryParam("permissions") String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -283,8 +282,7 @@ public class Server {
@FormParam("group") String group,
@FormParam("permissions") String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(oldTable, ":table");
@@ -304,8 +302,7 @@ public class Server {
@PathParam("table") String table,
@PathParam("property") String property)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -324,8 +321,7 @@ public class Server {
public Response listTableProperties(@PathParam("db") String db,
@PathParam("table") String table)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -345,8 +341,7 @@ public class Server {
@PathParam("property") String property,
TablePropertyDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -366,8 +361,7 @@ public class Server {
public Response listPartitions(@PathParam("db") String db,
@PathParam("table") String table)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -386,8 +380,7 @@ public class Server {
@PathParam("table") String table,
@PathParam("partition") String partition)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -408,8 +401,7 @@ public class Server {
@PathParam("partition") String partition,
PartitionDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -432,15 +424,14 @@ public class Server {
@QueryParam("group") String group,
@QueryParam("permissions") String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
verifyParam(partition, ":partition");
HcatDelegator d = new HcatDelegator(appConf, execService);
return d.dropPartition(getUser(), db, table, partition, ifExists,
- group, permissions);
+ group, permissions);
}
/**
@@ -451,12 +442,11 @@ public class Server {
@Produces(MediaType.APPLICATION_JSON)
public Response listDatabases(@QueryParam("like") String dbPattern)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
HcatDelegator d = new HcatDelegator(appConf, execService);
- if (! TempletonUtils.isset(dbPattern))
+ if (!TempletonUtils.isset(dbPattern))
dbPattern = "*";
return d.listDatabases(getUser(), dbPattern);
}
@@ -470,8 +460,7 @@ public class Server {
public Response descDatabase(@PathParam("db") String db,
@QueryParam("format") String format)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
HcatDelegator d = new HcatDelegator(appConf, execService);
@@ -487,8 +476,7 @@ public class Server {
public Response createDatabase(@PathParam("db") String db,
DatabaseDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
desc.database = db;
@@ -508,15 +496,14 @@ public class Server {
@QueryParam("group") String group,
@QueryParam("permissions") String permissions)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
if (TempletonUtils.isset(option))
verifyDdlParam(option, "option");
HcatDelegator d = new HcatDelegator(appConf, execService);
return d.dropDatabase(getUser(), db, ifExists, option,
- group, permissions);
+ group, permissions);
}
/**
@@ -529,8 +516,7 @@ public class Server {
public Response listColumns(@PathParam("db") String db,
@PathParam("table") String table)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -549,8 +535,7 @@ public class Server {
@PathParam("table") String table,
@PathParam("column") String column)
throws SimpleWebException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -571,8 +556,7 @@ public class Server {
@PathParam("column") String column,
ColumnDesc desc)
throws HcatException, NotAuthorizedException, BusyException,
- BadParam, ExecuteException, IOException
- {
+ BadParam, ExecuteException, IOException {
verifyUser();
verifyDdlParam(db, ":db");
verifyDdlParam(table, ":table");
@@ -601,8 +585,7 @@ public class Server {
@FormParam("statusdir") String statusdir,
@FormParam("callback") String callback)
throws NotAuthorizedException, BusyException, BadParam, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
verifyUser();
verifyParam(inputs, "input");
verifyParam(mapper, "mapper");
@@ -610,8 +593,8 @@ public class Server {
StreamingDelegator d = new StreamingDelegator(appConf);
return d.run(getUser(), inputs, output, mapper, reducer,
- files, defines, cmdenvs, args,
- statusdir, callback, getCompletedUrl());
+ files, defines, cmdenvs, args,
+ statusdir, callback, getCompletedUrl());
}
/**
@@ -629,17 +612,16 @@ public class Server {
@FormParam("statusdir") String statusdir,
@FormParam("callback") String callback)
throws NotAuthorizedException, BusyException, BadParam, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
verifyUser();
verifyParam(jar, "jar");
verifyParam(mainClass, "class");
JarDelegator d = new JarDelegator(appConf);
return d.run(getUser(),
- jar, mainClass,
- libjars, files, args, defines,
- statusdir, callback, getCompletedUrl());
+ jar, mainClass,
+ libjars, files, args, defines,
+ statusdir, callback, getCompletedUrl());
}
/**
@@ -655,17 +637,16 @@ public class Server {
@FormParam("statusdir") String statusdir,
@FormParam("callback") String callback)
throws NotAuthorizedException, BusyException, BadParam, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
verifyUser();
if (execute == null && srcFile == null)
throw new BadParam("Either execute or file parameter required");
PigDelegator d = new PigDelegator(appConf);
return d.run(getUser(),
- execute, srcFile,
- pigArgs, otherFiles,
- statusdir, callback, getCompletedUrl());
+ execute, srcFile,
+ pigArgs, otherFiles,
+ statusdir, callback, getCompletedUrl());
}
/**
@@ -680,15 +661,14 @@ public class Server {
@FormParam("statusdir") String statusdir,
@FormParam("callback") String callback)
throws NotAuthorizedException, BusyException, BadParam, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
verifyUser();
if (execute == null && srcFile == null)
throw new BadParam("Either execute or file parameter required");
HiveDelegator d = new HiveDelegator(appConf);
return d.run(getUser(), execute, srcFile, defines,
- statusdir, callback, getCompletedUrl());
+ statusdir, callback, getCompletedUrl());
}
/**
@@ -698,8 +678,7 @@ public class Server {
@Path("queue/{jobid}")
@Produces({MediaType.APPLICATION_JSON})
public QueueStatusBean showQueueId(@PathParam("jobid") String jobid)
- throws NotAuthorizedException, BadParam, IOException
- {
+ throws NotAuthorizedException, BadParam, IOException {
verifyUser();
verifyParam(jobid, ":jobid");
@@ -714,8 +693,7 @@ public class Server {
@Path("queue/{jobid}")
@Produces({MediaType.APPLICATION_JSON})
public QueueStatusBean deleteQueueId(@PathParam("jobid") String jobid)
- throws NotAuthorizedException, BadParam, IOException
- {
+ throws NotAuthorizedException, BadParam, IOException {
verifyUser();
verifyParam(jobid, ":jobid");
@@ -730,8 +708,7 @@ public class Server {
@Path("queue")
@Produces({MediaType.APPLICATION_JSON})
public List<String> showQueueList()
- throws NotAuthorizedException, BadParam, IOException
- {
+ throws NotAuthorizedException, BadParam, IOException {
verifyUser();
ListDelegator d = new ListDelegator(appConf);
@@ -745,8 +722,7 @@ public class Server {
@Path("internal/complete/{jobid}")
@Produces({MediaType.APPLICATION_JSON})
public CompleteBean completeJob(@PathParam("jobid") String jobid)
- throws CallbackFailedException, IOException
- {
+ throws CallbackFailedException, IOException {
CompleteDelegator d = new CompleteDelegator(appConf);
return d.run(jobid);
}
@@ -755,11 +731,10 @@ public class Server {
* Verify that we have a valid user. Throw an exception if invalid.
*/
public void verifyUser()
- throws NotAuthorizedException
- {
+ throws NotAuthorizedException {
if (getUser() == null) {
String msg = "No user found.";
- if (! UserGroupInformation.isSecurityEnabled())
+ if (!UserGroupInformation.isSecurityEnabled())
msg += " Missing " + PseudoAuthenticator.USER_NAME + " parameter.";
throw new NotAuthorizedException(msg);
}
@@ -769,8 +744,7 @@ public class Server {
* Verify that the parameter exists. Throw an exception if invalid.
*/
public void verifyParam(String param, String name)
- throws BadParam
- {
+ throws BadParam {
if (param == null)
throw new BadParam("Missing " + name + " parameter");
}
@@ -779,8 +753,7 @@ public class Server {
* Verify that the parameter exists. Throw an exception if invalid.
*/
public void verifyParam(List<String> param, String name)
- throws BadParam
- {
+ throws BadParam {
if (param == null || param.isEmpty())
throw new BadParam("Missing " + name + " parameter");
}
@@ -794,12 +767,11 @@ public class Server {
* Bug: This needs to allow for quoted ddl identifiers.
*/
public void verifyDdlParam(String param, String name)
- throws BadParam
- {
+ throws BadParam {
verifyParam(param, name);
Matcher m = DDL_ID.matcher(param);
- if (! m.matches())
- throw new BadParam("Invalid DDL identifier " + name );
+ if (!m.matches())
+ throw new BadParam("Invalid DDL identifier " + name);
}
/**
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleExceptionMapper.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleExceptionMapper.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleExceptionMapper.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleExceptionMapper.java Mon Sep 10 23:28:55 2012
@@ -27,8 +27,7 @@ import javax.ws.rs.ext.Provider;
*/
@Provider
public class SimpleExceptionMapper
- implements ExceptionMapper<SimpleWebException>
-{
+ implements ExceptionMapper<SimpleWebException> {
public Response toResponse(SimpleWebException e) {
return e.getResponse();
}
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleWebException.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleWebException.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleWebException.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/SimpleWebException.java Mon Sep 10 23:28:55 2012
@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.HashMap;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import org.codehaus.jackson.map.ObjectMapper;
/**
@@ -50,9 +51,8 @@ public class SimpleWebException extends
}
public static Response buildMessage(int httpCode, Map<String, Object> params,
- String msg)
- {
- HashMap<String,Object> err = new HashMap<String,Object>();
+ String msg) {
+ HashMap<String, Object> err = new HashMap<String, Object>();
err.put("error", msg);
if (params != null)
err.putAll(params);
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StatusDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StatusDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StatusDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StatusDelegator.java Mon Sep 10 23:28:55 2012
@@ -18,6 +18,7 @@
package org.apache.hcatalog.templeton;
import java.io.IOException;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.mapred.JobID;
@@ -39,15 +40,14 @@ public class StatusDelegator extends Tem
}
public QueueStatusBean run(String user, String id)
- throws NotAuthorizedException, BadParam, IOException
- {
+ throws NotAuthorizedException, BadParam, IOException {
UserGroupInformation ugi = UserGroupInformation.createRemoteUser(user);
TempletonJobTracker tracker = null;
JobState state = null;
try {
tracker = new TempletonJobTracker(ugi,
- JobTracker.getAddress(appConf),
- appConf);
+ JobTracker.getAddress(appConf),
+ appConf);
JobID jobid = StatusDelegator.StringToJobID(id);
if (jobid == null)
throw new BadParam("Invalid jobid: " + id);
@@ -67,8 +67,7 @@ public class StatusDelegator extends Tem
JobID jobid,
String childid,
JobState state)
- throws BadParam, IOException
- {
+ throws BadParam, IOException {
JobID bestid = jobid;
if (childid != null)
bestid = StatusDelegator.StringToJobID(childid);
@@ -94,8 +93,7 @@ public class StatusDelegator extends Tem
public static QueueStatusBean makeStatus(TempletonJobTracker tracker,
JobID jobid,
JobState state)
- throws BadParam, IOException
- {
+ throws BadParam, IOException {
return makeStatus(tracker, jobid, state.getChildId(), state);
}
@@ -103,8 +101,7 @@ public class StatusDelegator extends Tem
* A version of JobID.forName with our app specific error handling.
*/
public static JobID StringToJobID(String id)
- throws BadParam
- {
+ throws BadParam {
try {
return JobID.forName(id);
} catch (IllegalArgumentException e) {
Modified: incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StreamingDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StreamingDelegator.java?rev=1383152&r1=1383151&r2=1383152&view=diff
==============================================================================
--- incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StreamingDelegator.java (original)
+++ incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/StreamingDelegator.java Mon Sep 10 23:28:55 2012
@@ -20,11 +20,12 @@ package org.apache.hcatalog.templeton;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+
import org.apache.commons.exec.ExecuteException;
/**
* Submit a streaming job to the MapReduce queue. Really just a front
- end to the JarDelegator.
+ end to the JarDelegator.
*
* This is the backend of the mapreduce/streaming web service.
*/
@@ -43,16 +44,15 @@ public class StreamingDelegator extends
String callback,
String completedUrl)
throws NotAuthorizedException, BadParam, BusyException, QueueException,
- ExecuteException, IOException, InterruptedException
- {
+ ExecuteException, IOException, InterruptedException {
List<String> args = makeArgs(inputs, output, mapper, reducer,
- files, defines, cmdenvs, jarArgs);
+ files, defines, cmdenvs, jarArgs);
JarDelegator d = new JarDelegator(appConf);
return d.run(user,
- appConf.streamingJar(), null,
- null, null, args, defines,
- statusdir, callback, completedUrl);
+ appConf.streamingJar(), null,
+ null, null, args, defines,
+ statusdir, callback, completedUrl);
}
private List<String> makeArgs(List<String> inputs,
@@ -62,8 +62,7 @@ public class StreamingDelegator extends
List<String> files,
List<String> defines,
List<String> cmdenvs,
- List<String> jarArgs)
- {
+ List<String> jarArgs) {
ArrayList<String> args = new ArrayList<String>();
for (String input : inputs) {
args.add("-input");