/** * Submit jar file * * @param conf the topology-specific configuration. See {@link Config}. * @param localJar file path of the jar file to submit * @return the remote location of the submitted jar */ public static String submitJar(Map<String, Object> conf, String localJar) { return submitJar(conf, localJar, null); }
private static String submitJar(Map<String, Object> conf, ProgressListener listener) { return submitJar(conf, System.getProperty("storm.jar"), listener); }
public static void main(String[] args) throws Exception { if (args.length <= 1) { LOG.error("Arguments should be of the form: <path_to_jar> [argument...]"); System.exit(-1); } Map<String,Object> conf = ConfigUtils.readStormConfig(); try (NimbusClient client = NimbusClient.getConfiguredClient(conf)) { NimbusSummary ns = client.getClient().getLeader(); String host = ns.get_host(); int port = ns.get_port(); String jarPath = StormSubmitter.submitJar(conf, args[0]); String[] newArgs = (String[]) ArrayUtils.addAll(Arrays.copyOfRange(args, 1, args.length), new String[]{host, String.valueOf(port), jarPath}); ServerUtils.execCommand(newArgs); } } }
/** * Submit jar file * @param conf the topology-specific configuration. See {@link Config}. * @param localJar file path of the jar file to submit * @return the remote location of the submitted jar */ public static String submitJar(Map conf, String localJar) { return submitJar(conf, localJar, null); }
private static String submitJar(Map conf, ProgressListener listener) { return submitJar(conf, System.getProperty("storm.jar"), listener); }