private void buildS3InputFileInfo() throws RuntimeException {
        String hboxS3Inputs = envs.get(HboxConstants.Environment.HBOX_S3_INPUTS.toString());
        if (StringUtils.isBlank(hboxS3Inputs)) {
            LOG.info("Application has no amazon s3 inputs");
            return;
        }
        /**
         * input1#local1
         * input2,input3#local2
         */
        String[] inputs = StringUtils.split(hboxS3Inputs, "|");
        if (inputs != null && inputs.length > 0) {
            for (String input : inputs) {
                // input: input2,input3#local2
                String[] s3InputPathTuple = StringUtils.split(input, "#");
                if (s3InputPathTuple.length < 2) {
                    throw new RuntimeException("Error input path format " + hboxS3Inputs);
                }
                InputInfo info = new InputInfo();
                List<S3File> s3FileList = new ArrayList<>();
                String inputBuckets = s3InputPathTuple[0];
                String inputLocalDir = s3InputPathTuple[1];
                info.setAliasName(inputLocalDir);
                String clusterPrefix = conf.get(
                        HboxConfiguration.HBOX_S3_CLUSTER_PREFIX, HboxConfiguration.DEFAULT_HBOX_S3_CLUSTER_PREFIX);
                String s3Cluster =
                        conf.get(HboxConfiguration.HBOX_S3_CLUSTER, HboxConfiguration.DEFAULT_HBOX_S3_CLUSTER);
                if (!s3Cluster.startsWith(clusterPrefix)) s3Cluster = clusterPrefix + s3Cluster;
                String s3AccessKey =
                        conf.get(HboxConfiguration.HBOX_S3_ACCESS_KEY, HboxConfiguration.DEFAULT_HBOX_S3_ACCESS_KEY);
                String s3SecretKey =
                        conf.get(HboxConfiguration.HBOX_S3_SECRET_KEY, HboxConfiguration.DEFAULT_HBOX_S3_SECRET_KEY);
                boolean correctS3Conf = !s3Cluster.equals("") && !s3AccessKey.equals("") && !s3SecretKey.equals("");
                for (String bucket : StringUtils.split(inputBuckets, ",")) {
                    String bucketName = bucket;
                    String prefix = "";
                    String split = conf.get(
                            HboxConfiguration.HBOX_S3_BUCKET_DIR_SPLIT,
                            HboxConfiguration.DEFAULT_HBOX_S3_BUCKET_DIR_SPLIT);
                    if (bucket.contains(split)) {
                        bucketName = bucket.substring(0, bucket.indexOf(split));
                        prefix = bucket.substring(bucket.indexOf(split) + 1);
                    }
                    AmazonS3 s3 = new AmazonS3(s3Cluster, bucketName, s3AccessKey, s3SecretKey);
                    if (s3.doesBucketExist() && correctS3Conf) {
                        for (S3ObjectSummary obj : s3.listObjects(prefix)) {
                            String objKey = obj.getKey();
                            S3File s3File = new S3File(
                                    bucketName, objKey, s3.getUrl(objKey).toString());
                            s3FileList.add(s3File);
                        }
                    } else {
                        throw new RuntimeException("Error input bucket format " + hboxS3Inputs
                                + "or submit shell doesn't have correct config.");
                    }
                }
                info.setS3Files(s3FileList);
                info.setInputType(HboxConstants.S3);
                s3Input2InputInfo.put(inputLocalDir, info);
                // append local dir path in inputPath
                this.inputPath.append(inputLocalDir).append(",");
                if (s3FileList.size() > 0) {
                    if (s3FileList.size() < workerNum) {
                        LOG.warn("File count in  bucket " + inputBuckets + "  " + s3FileList.size()
                                + " less than the worker count " + workerNum);
                    }
                }
            }
        }
    }
Constructor, connect to Resource Manager

@throws IOException
core/src/main/java/net/qihoo/hbox/AM/ApplicationMaster.java