MCPcopy Create free account
hub / github.com/OpenAS2/OpenAs2App / process

Method process

Server/src/main/java/SplitCsvFile.java:75–108  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

73 }
74
75 private void process(String[] args) throws Exception {
76 CommandLine options = parseCommandLine(args);
77 if (options == null) {
78 return;
79 }
80 String sourceFileName = options.getOptionValue(SOURCE_FILE);
81 File sourceFile = new File(sourceFileName);
82 if (!sourceFile.exists()) {
83 throw new Exception("File does not exist: " + sourceFileName);
84 }
85 long maxFileSize = Long.parseLong(options.getOptionValue(MAX_FILE_SIZE));
86 String outputDirName = null;
87 if (options.hasOption(OUTPUT_DIR)) {
88 outputDirName = options.getOptionValue(OUTPUT_DIR);
89 } else {
90 outputDirName = System.getProperty("user.dir");
91 }
92 String prefix = (options.hasOption(OUT_FILENAME_PREFIX)) ? options.getOptionValue(OUT_FILENAME_PREFIX) : "";
93 boolean hasHeaderRow = options.hasOption(HAS_HEADER_ROW);
94
95 if (options.hasOption(DEBUG) && "true".equalsIgnoreCase(options.getOptionValue(DEBUG))) {
96 System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
97 System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
98 System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "DEBUG");
99 System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "ERROR");
100 }
101 try {
102 FileUtil.splitLineBasedFile(sourceFile, outputDirName, maxFileSize, hasHeaderRow, sourceFile.getName(), prefix);
103 } catch (Exception e) {
104 e.printStackTrace();
105 System.out.println("Processing error occurred: " + e.getMessage());
106 System.exit(-1);
107 }
108 }
109
110 public static void main(String[] args) {
111 try {

Callers 1

mainMethod · 0.95

Calls 6

parseCommandLineMethod · 0.95
splitLineBasedFileMethod · 0.95
getPropertyMethod · 0.80
setPropertyMethod · 0.80
getNameMethod · 0.65
getMessageMethod · 0.65

Tested by

no test coverage detected