11
11
import java .util .logging .Logger ;
12
12
import java .util .logging .SimpleFormatter ;
13
13
14
- import sun .reflect .generics .reflectiveObjects .NotImplementedException ;
15
-
16
14
/**
17
15
* main.Main user-facing class. Directs all actions.
18
16
*/
19
17
public class Main {
20
18
21
19
//delimiters
22
- public static String DELIM_SHARED = "|" ;
23
20
public static String DIRECTORY_PATH_IN = "./main/sample_data/" ; //TODO allow custom path
24
21
public static String DIRECTORY_PATH_CONF = "./main/config/" ; //TODO allow custom path
25
22
public static String DIRECTORY_PATH_OUT = "../output/" ; //TODO allow custom path
26
- private String EXPORT_FILENAME = "export" ; //name of each exported file in 'output/' (collection name)
23
+ private String EXPORT_FILENAME = "export" ; //name of each exported file in 'output/' (collection name)
27
24
28
25
// configure logger
29
26
private static Logger LOGGER = Logger .getLogger (Main .class .getName ());
30
27
31
28
32
- // - public facing back end
33
-
34
29
/**
35
30
* Main function responsible for taking in user input at the command line,
36
31
* handling flags, and directing overall behavior of the program.
37
- * @param args list of files (?)
38
32
* @throws IOException
39
33
* @throws ParseException
40
34
*/
@@ -43,7 +37,7 @@ public static void main(String[] args) throws IOException, ParseException {
43
37
// - get input from the user command line - //
44
38
String header = "A cataloguing tool for converting specially formatted text files containing dublin " +
45
39
"core metadata into various formats\n " ;
46
- String footer = "" ;
40
+ String footer = "-- developed by @atla5 on behalf of RIT Wallace and BU Mugar libraries. " ;
47
41
CommandLineParser posixParser = new PosixParser ();
48
42
Options options = new Options ();
49
43
@@ -101,13 +95,6 @@ public static void main(String[] args) throws IOException, ParseException {
101
95
System .exit (0 );
102
96
}
103
97
104
- //display help information for dublin core
105
- if (commandLine .hasOption ('d' )) {
106
- throw new NotImplementedException ();
107
- //System.exit(0);
108
- }
109
-
110
-
111
98
/* - run the program in the absence of these tags */
112
99
113
100
//instantiate a new parser
@@ -141,16 +128,14 @@ public static void main(String[] args) throws IOException, ParseException {
141
128
142
129
int id = 1 ;
143
130
//foreach file in the directory...
131
+ File folder = new File (DIRECTORY_PATH_IN );
132
+ File [] lsFiles = folder .listFiles ();
144
133
145
- String waldo = "sample-metadata-file.txt" ;
146
- String sample = "1990-v123n04.txt" ;
147
- String [] lsFiles = { waldo , sample };
148
-
149
- for (String filename : lsFiles ) {
150
- String path = DIRECTORY_PATH_IN + filename ;
134
+ for (File filename : lsFiles ) {
135
+ String path = filename .getAbsolutePath ();
151
136
152
137
//todo: harvest metadata from file and use it to populate provenance information
153
- p .processMetadataFile (processFileIntoStringArray (DIRECTORY_PATH_IN + filename ), id );
138
+ p .processMetadataFile (processFileIntoStringArray (path ), id );
154
139
id ++;
155
140
}
156
141
//end foreach file in directory...
0 commit comments