1 | package org.greenstone.gsdl3.gs3build;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 | import java.util.ArrayList;
|
---|
5 |
|
---|
6 | public class Build
|
---|
7 | {
|
---|
8 | BuildManager manager;
|
---|
9 |
|
---|
10 | public Build(List inputRoots, String site, String collection, String outputDir)
|
---|
11 | { this.manager = new BuildManager(inputRoots, site, collection, outputDir);
|
---|
12 | }
|
---|
13 |
|
---|
14 | public void run()
|
---|
15 | { this.manager.run();
|
---|
16 | }
|
---|
17 |
|
---|
18 | public static void main(String args[])
|
---|
19 | { int a = 0;
|
---|
20 | List inputDirs = new ArrayList();
|
---|
21 | String collection = null;
|
---|
22 | String site = null;
|
---|
23 | String outputDir = null;
|
---|
24 |
|
---|
25 | while (a < args.length)
|
---|
26 | { System.out.println(args[a]);
|
---|
27 | if (args[a].equals("-inputdir")) {
|
---|
28 | if (a < args.length - 1 &&
|
---|
29 | args[a+1].charAt(0) != '-')
|
---|
30 | {
|
---|
31 | inputDirs.add(args[a+1]);
|
---|
32 | a ++;
|
---|
33 | }
|
---|
34 | }
|
---|
35 | else if (args[a].equals("-collect")) {
|
---|
36 | if (a < args.length - 1 &&
|
---|
37 | args[a+1].charAt(0) != '-')
|
---|
38 | {
|
---|
39 | collection = args[a+1];
|
---|
40 | a ++;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | else if (args[a].equals("-site")) {
|
---|
44 | if (a < args.length - 1 &&
|
---|
45 | args[a+1].charAt(0) != '-')
|
---|
46 | {
|
---|
47 | site = args[a+1];
|
---|
48 | a ++;
|
---|
49 | }
|
---|
50 | }
|
---|
51 | else if (args[a].equals("-outputDir")) {
|
---|
52 | if (a < args.length - 1 &&
|
---|
53 | args[a+1].charAt(0) != '-')
|
---|
54 | { outputDir = args[a+1];
|
---|
55 | a ++;
|
---|
56 | }
|
---|
57 | }
|
---|
58 | a ++;
|
---|
59 | }
|
---|
60 |
|
---|
61 | if (site==null) {
|
---|
62 | System.err.println("you must specify the site name");
|
---|
63 | System.exit(0);
|
---|
64 | }
|
---|
65 | if (collection == null && inputDirs.size() == 0) {
|
---|
66 | System.err.println("At least one input directory must be given, or a collection name");
|
---|
67 | System.exit(0);
|
---|
68 | }
|
---|
69 |
|
---|
70 | Build build = new Build(inputDirs, site, collection, outputDir);
|
---|
71 | build.run();
|
---|
72 |
|
---|
73 | return;
|
---|
74 | }
|
---|
75 | }
|
---|